package com.ilove.friend.model;

import javax.microedition.lcdui.Image;

import org.kalmeo.kuix.core.model.DataProvider;

public class FriendList extends DataProvider {
	private static final String CODE_PROPERTY = "code";
	private static final String NAME_PROPERTY = "name";
	private static final String INFO_PROPERTY = "info";
	private static final String PREVIEWIMAGE_PROPERTY = "previewimage";
	public String code;
	public String name;
	public Image previewimage;
	public String info;
	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
		dispatchUpdateEvent(NAME_PROPERTY);
	}
	public void setInfo(String info) {
		this.info = info;
		dispatchUpdateEvent(INFO_PROPERTY);
	}
	public void setPreviewimage(Image img) {
		this.previewimage = img;
		dispatchUpdateEvent(PREVIEWIMAGE_PROPERTY);
	}
	public void setCode(String code) {
		this.code = code;
		dispatchUpdateEvent(NAME_PROPERTY);
	}

	/* (non-Javadoc)
	 * @see org.kalmeo.kuix.core.model.DataProvider#getUserDefinedValue(java.lang.String)
	 */
	protected Object getUserDefinedValue(String property) {
		if (NAME_PROPERTY.equals(property)) {
			return this.name;
		}
		if (CODE_PROPERTY.equals(property)) {
			return this.code;
		}
		if (PREVIEWIMAGE_PROPERTY.equals(property)) {
			return this.previewimage;
		}
		if (INFO_PROPERTY.equals(property)) {
			return this.info;
		}
		return null;
	}
}
